# coding:utf8
from langchain_community.embeddings import DashScopeEmbeddings
from typing import List

dashscope_api_key = "sk-cb4016a8cf3943d799710a03a8993e61"

def embedding(inputStr: str) -> List[float]:
    embeddings = DashScopeEmbeddings(
        model="text-embedding-v1", dashscope_api_key=dashscope_api_key
    )
    response = embeddings.embed_query(inputStr)
    return response

# test embedding
emb_res = embedding("测试文本")
print(emb_res)